<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('就业统计')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row" style="height: 800px">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <input placeholder="城市名称"  id="address" name="address" class="form-control" type="text" required>
                        </li>

                        <li class="select-time">
                            <input type="text" class="time-input" id="beginDate" placeholder="开始时间" name="beginDate"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endDate"   placeholder="结束时间" name="endDate"/>
                        </li>
                       <div id="element">
                           <li class="select-time">
                               <select id="schoolId" name="schoolId" class="type form-control uname"   >
                                   <!--<option  th:field="*{schoolId}">{{shcoolName}} </option>-->
                               </select>
                           </li>
                           <li class="select-time">
                               <select id="majorId" name="majorId" class="router form-control uname"    >
                                   <!--<option  th:field="*{majorId}"></option>-->
                               </select>
                           </li>

                       </div>
                        <li class="select-time">
                            <select name="groupby" id="groupby" placeholder="统计节点" class="form-control m-b" >
                                <option value="b.shcool_id">学院</option>
                                <option value="b.major_id">专业</option>
                                <option value="a.address">地区</option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="statisticsEmployment()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <!--<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->
                        </li>
                    </ul>
                </div>
            </form>

        </div>

        <div class="ibox-content" style="height: 800px">
            <div class="echarts" style="height: 700px" id="info-chart"></div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: echarts-js" />
<th:block th:include="include :: jquery-cxselect-js" />
<script th:inline="javascript">
    var nameList = new Array();
    var valueList = new Array();
    var prefix = ctx + "photograph/statistics";
    $(function () {
        statisticsEmployment();
        listCascade();
    })
    function listCascade() {
        var url = '/photograph/school/listCascade';

        $.operate.get(url,function (result) {

            if (result.code==0){
                var data =result.data;
                $('#element').cxSelect({
                    selects: ['type', 'router'],
                    jsonValue: 'v',
                    data: data
                });
            }

        });
    };
    function statisticsEmployment() {
        var address = $.common.trim($("input[name='address']").val());
        var endDate = $("input[name='endDate']").val();
        var beginDate = $("input[name='beginDate']").val();
        var schoolId = $("#schoolId option:checked").val();
        var majorId = $("#majorId option:checked").val();
        var groupby = $("#groupby option:checked").val();

        var url = prefix+'/statisticsEmployment';


        var data= {
            "address": address,
            "endDate": endDate,
            "schoolId": schoolId,
            "majorId": majorId,
            "groupby" : groupby,
            "beginDate": beginDate,
        }
        $.operate.post(url,data,function (result) {

            if (result.code==0){
                var data =result.data;
                var message =result.data.message;
                // 基于准备好的dom，初始化echarts实例
                var infoChart = echarts.init(document.getElementById('info-chart'));
                nameList.splice(0,nameList.length);
                valueList.splice(0,valueList.length);
                for(var i=0;i<data.length;i++){
                    nameList.push(data.statisticsEmploymentVos[i].name);
                    valueList.push(data.statisticsEmploymentVos[i].value)
                }

                // 指定图表的配置项和数据
                var option = {
                    title : {
                        text: '就业统计',
                        subtext: message,
                        x:'center'
                    },
                    tooltip : {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
                    legend: {
                        orient : 'vertical',
                        x : 'left',
                        data:nameList
                    },
                    calculable : true,
                    series : [
                        {
                            name:'访问来源',
                            type:'pie',
                            radius : '70%',
                            center: ['50%', '60%'],
                            data:data.statisticsEmploymentVos
                        }
                    ]
                };

                // 使用刚指定的配置项和数据显示图表。
                infoChart.setOption(option);
            }

        })

    }
//    function statisticsEmployment() {

////        var address = $.common.trim($("input[name='address']").val());
////        var beginTime = $("inp ut[name='beginTime']").val();
////        var endTime = $("input[name='endTime']").val();
////        var shcooId = $("#schoolId option:checked").val();
////        var majorId = $("#majorId option:checked").val();
////        var groupby = $("#groupby option:checked").val();
//
//        var url = prefix+'/statisticsEmployment';
//        var data= {
//            "address": address
////            ,
////            "beginTime": beginTime,
////            "endTime": endTime,
////            "shcooId": shcooId,
////            "majorId": majorId,
////            "groupby" : groupby
//        }
////        $.operate.post(url,data,function (result) {
////
////            if (result.code==0){
////                var data =result.data;
////                // 基于准备好的dom，初始化echarts实例
////                var infoChart = echarts.init(document.getElementById('info-chart'));
////                nameList.splice(0,bagNameList.length);
////                valueList.splice(0,scoreList.length);
////                for(var i=0;i<data.length;i++){
////                    nameList.push(data[i].name);
////                    valueList.push(data[i].value)
////                }
////
////                // 指定图表的配置项和数据
////                var option = {
////                    title : {
////                        text: '某站点用户访问来源',
////                        subtext: '纯属虚构',
////                        x:'center'
////                    },
////                    tooltip : {
////                        trigger: 'item',
////                        formatter: "{a} <br/>{b} : {c} ({d}%)"
////                    },
////                    legend: {
////                        orient : 'vertical',
////                        x : 'left',
////                        data:nameList
////                    },
////                    calculable : true,
////                    series : [
////                        {
////                            name:'访问来源',
////                            type:'pie',
////                            radius : '55%',
////                            center: ['50%', '60%'],
////                            data:data
////                        }
////                    ]
////                };
////
////                // 使用刚指定的配置项和数据显示图表。
////                infoChart.setOption(option);
////            }
////
////        })
//    }
//    $(function() {
//        var options = {
//            url: prefix + "/list",
//            createUrl: prefix + "/add",
//            updateUrl: prefix + "/edit/{id}",
//            removeUrl: prefix + "/remove",
//            exportUrl: prefix + "/export",
//            modalName: "学院管理",
//            columns: [{
//                checkbox: true
//            },
//                {
//                    field: 'id',
//                    title: '学院id',
//                    visible: false
//                },
//                {
//                    field: 'schooLname',
//                    title: '学院名称'
//                },
//                {
//                    field: 'majorWeight',
//                    title: '学院权重'
//                },
//                {
//                    field: 'createTime',
//                    title: '创建时间'
//                },
//                {
//                    title: '操作',
//                    align: 'center',
//                    formatter: function(value, row, index) {
//                        var actions = [];
//                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
//                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
//                        return actions.join('');
//                    }
//                }]
//        };
//        $.table.init(options);
//    });
</script>
</body>
</html>